
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>requests.http</title>
    <style type="text/css" media="screen">
      html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p,
      blockquote, pre, a, abbr, address, cite, code, del, dfn, em, figure,
      img, ins, kbd, q, s, samp, small, strong, sub, sup, var, b, u, i, dl,
      dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption,
      tbody, tfoot, thead, tr, th, td {
        background: transparent none repeat scroll 0 0;
        border: 0 none;
        font-size: 100%;
        margin: 0;
        outline: 0 none;
        padding: 0;
        vertical-align: baseline;
      }

      h1 { font-size: 200%; }
      h2 { font-size: 160%; }
      h3 { font-size: 120%; }
      h4 { font-size: 100%; }
      h5 { font-size: 80%; }
      h6 { font-size: 80%; font-weight: normal; }

      ul, ol {
        margin: 1.4em 0;
      }
      ul ul, ol ol, ul ol, ol ul {
        margin-top: 0;
        margin-bottom: 0;
      }
      ul, ol {
        margin-left: 2.8em;
      }

      ol {
        list-style: decimal;
      }
      ol ol {
        list-style: lower-alpha;
      }
      ol ol ol {
        list-style: lower-roman;
      }
      ol ol ol ol {
        list-style: decimal;
      }

      blockquote {
        margin: 0.1em;
        margin-left: 1em;
        border-left: 2px solid #cccccc;
        padding-left: 0.7em;
      }

      .color_red { color: #dc322f; }
      .color_blue { color: #268bd2; }
      .color_green { color: #859901; }
      .color_yellow { color: #b58901; }
      .color_black { color: black; }
      .color_white { color: white; }

      .font_big {
        font-size: 1.2em;
      }

      .ddoc_section_h {
        font-weight: bold;
        font-size: 13px;
        line-height: 19.5px;
        margin-top: 11px;
        display: block;
      }

      body.dlang .dlang {
        display: inline-block;
      }

      body.dlang .declaration .dlang {
          display: block;
      }

      body.dlang .ddoc_header_anchor a.dlang {
        display: block;
        color: rgba(0, 136, 204, 1);
        text-decoration: none;
      }

      body.dlang .ddoc_header_anchor .code {
        color: rgba(0, 136, 204, 1);
      }

      #ddoc_main .module {
          border-color: currentColor rgba(233, 233, 233, 1) rgba(233, 233, 233, 1);
          border-style: none solid solid;
          border-width: 0 1px 1px;
          overflow-x: hidden;
          padding: 15px;
      }

      #ddoc_main .section .section {
        margin-top: 0;
      }

      #ddoc_main .ddoc_module_members_section {
          padding: 1px 0 0;
          transition: transform 0.3s ease 0s;
      }

      #ddoc_main .ddoc_member, #ddoc_main .ddoc_module_members section.intro {
          background: #fff none repeat scroll 0 0;
          list-style-type: none;
          width: 100%;
      }

      #ddoc_main .ddoc_header_anchor {
          font-size: 1.4em;
          transition: transform 0.3s ease 0s;
      }

      #ddoc_main .ddoc_header_anchor > .code {
          display: inline-block;

      }

      #ddoc_main .ddoc_decl {
        background-color: transparent;
        height: 100%;
        left: 0;
        top: 0;
        padding: 0;
        padding-left: 15px;
      }

      #ddoc_main .ddoc_decl .section, #ddoc_main .section.ddoc_sections {
        background: white none repeat scroll 0 0;
        margin: 0;
        padding: 5px;
        position: relative;
        border-radius: 5px;
      }

      #ddoc_main .ddoc_decl .section h4:first-of-type, #ddoc_main .section.ddoc_sections h4:first-of-type {
        font-size: 13px;
        line-height: 1.5;
        margin-top: 21px;
      }

      #ddoc_main .section .declaration {
          margin-top: 21px;
      }

      #ddoc_main .section .declaration .code {
          color: rgba(0, 0, 0, 1);
          margin-bottom: 15px;
          padding-bottom: 6px;
      }

      #ddoc_main .declaration div .para {
          margin-bottom: 0;
      }

      #ddoc_main .ddoc_params .graybox tr td:first-of-type {
        padding: 7px;
        text-align: right;
        vertical-align: top;
        word-break: normal;
        white-space: nowrap;
      }

      #ddoc_main .ddoc_params .graybox {
        border: 0 none;
      }

      #ddoc_main .ddoc_params .graybox td {
        border-color: rgba(214, 214, 214, 1);
      }

      #ddoc_main .ddoc_params .graybox tr:first-child > td {
        border-top: 0 none;
      }

      #ddoc_main .ddoc_params .graybox tr:last-child > td {
        border-bottom: 0 none;
      }

      #ddoc_main .ddoc_params .graybox tr > td:first-child {
        border-left: 0 none;
      }

      #ddoc_main .ddoc_params .graybox tr > td:last-child {
        border-right: 0 none;
        width: 100%;
      }

      #ddoc_main em.term, #ddoc_main em.term .code {
        color: rgba(65, 65, 65, 1);
        font-size: 12px;
        font-style: italic;
        line-height: 1.5;
      }

      #ddoc_main .see-also {
        cursor: pointer;
        font-family: Menlo,monospace;
      }

      #ddoc_main .ddoc_decl .section > div:last-of-type {
        margin-bottom: 15px;
      }

      #ddoc_main .ddoc_member, #ddoc_main .ddoc_module_members {
          transition: transform 0.3s ease 0s;
      }

      #ddoc_main .code_sample {
        background: inherit;
      }

      #ddoc_main .declaration .code-line {
          display: block;
          font: 1em Menlo,monospace;
      }

      #ddoc_main a[name] {
        margin: -112px 0 0;
        padding-top: 112px;
      }

      #ddoc_main .ddoc_decl td {
        max-width: inherit;
      }

      #ddoc_main .declaration a {
        color: inherit;
      }

      #ddoc_main .declaration a:hover {
          color: rgba(0, 136, 204, 1);
          text-decoration: underline;
      }

      body.ddoc {
        background-color: transparent;
        color: rgba(0, 0, 0, 1);
        font-family: Helvetica,Arial,sans-serif;
        font-size: 62.5%;
        margin: 0;
        border: 0;
        left: 0;
        top: 0;
        padding: 0;
      }

      .ddoc a[name] {
        display: block;
        height: 0;
        margin: -85px 0 0;
        padding-top: 85px;
        width: 0;
      }

      .ddoc .module {
          border-color: transparent;
          background-color: rgba(255, 255, 255, 1);
          border-color: currentColor rgba(233, 233, 233, 1) rgba(233, 233, 233, 1);
          border-image: none;
          border-style: none solid solid;
          border-width: 0 1px 1px;
          box-shadow: 0 0 1px rgba(0, 0, 0, 0.07);
          display: block;
          margin-left: 0;
          min-height: calc(100% - 173px);
          overflow: auto;
          padding-bottom: 100px;
      }

      .ddoc .content_wrapper {
          background-color: rgba(242, 242, 242, 1);
          margin: 0 auto;
          max-width: 980px;
      }

      .ddoc .section {
        padding: 15px 25px 30px;
      }

      .ddoc .section .section {
        margin: 30px 0 0;
        padding: 0;
      }

      .ddoc .para {
        color: rgba(65, 65, 65, 1);
        font-size: 1.4em;
        line-height: 145%;
        margin-bottom: 15px;
      }

      .ddoc .ddoc_examples .para {
        margin-bottom: 0;
      }

      .ddoc .module_name {
          color: rgba(0, 0, 0, 1);
          display: block;
          font-family: Helvetica;
          font-size: 2.8em;
          font-weight: 100;
          margin-bottom: 0;
          padding: 15px 0;
      }

      .ddoc .module a {
          color: rgba(0, 136, 204, 1);
          text-decoration: none;
      }

      .ddoc .code {
        color: rgba(128, 128, 128, 1);
        font-family: Menlo,monospace;
        font-size: 0.85em;
        word-wrap: break-word;
      }

      .ddoc .code i {
        font-style: normal;
      }

      .ddoc .code .code {
        font-size: 1em;
      }

      .ddoc .code_sample {
        background-clip: padding-box;
        margin: 1px 0;
        text-align: left;
      }

      .ddoc .code_sample {
        display: block;
        font-size: 1.4em;
        margin-left: 21px;
      }

      .ddoc ol .code_sample {
        font-size: 1em;
      }

      .ddoc .code_lines {
        counter-reset: li;
        line-height: 1.6em;
        list-style: outside none none;
        margin: 0;
        padding: 0;
      }

      .ddoc .code_listing .code_sample div {
        margin-left: 13px;
        width: 93%;
      }

      .ddoc .code_listing .code_sample div .code_lines li {
        list-style-type: none;
        margin: 0;
        padding-right: 10px;
      }

      .ddoc .code_sample div .code_lines li::before {
        margin-left: -33px;
        margin-right: 25px;
      }

      .ddoc .code_sample div .code_lines li:nth-child(n+10)::before {
        margin-left: -39px;
        margin-right: 25px;
      }

      .ddoc .code_sample div .code_lines li:nth-child(n+100)::before {
        margin-left: -46px;
        margin-right: 25px;
      }

      .ddoc .code_sample .code_lines .code {
        color: #000;
      }

      .ddoc div.dlang {
        margin: 10px 0 21px;
        padding: 4px 0 2px 10px;
      }

      .ddoc div.dlang {
          margin: 10px 0 21px;
          padding: 4px 0 2px 10px;
      }

      .ddoc div.dlang {
        border-left: 5px solid rgba(0, 155, 51, 0.2);
      }

      .ddoc .code_lines li::before {
        color: rgba(128, 128, 128, 1);
        content: counter(li, decimal);
        counter-increment: li;
        font-family: Menlo,monospace;
        font-size: 0.9em;
        margin-right: 16px;
      }

      .ddoc .code_lines li {
        padding-left: 0;
        white-space: pre-wrap;
      }

      .ddoc .code_lines li:only-of-type::before {
        color: rgba(255, 255, 255, 1);
        content: " ";
      }

      .ddoc .code_lines li:only-of-type {
        color: rgba(255, 255, 255, 1);
        content: " ";
      }

      .ddoc .code_lines li:nth-child(n+10) {
        text-indent: -17px;
      }

      .ddoc .code_lines li:nth-child(n+10)::before {
        margin-right: 12px;
      }

      .ddoc .graybox {
        border: 1px solid rgba(233, 233, 233, 1);
        border-collapse: collapse;
        border-spacing: 0;
        empty-cells: hide;
        margin: 20px 0 36px;
        text-align: left;
      }

      .ddoc .graybox p {
        margin: 0;
        min-width: 50px;
      }

      .ddoc th {
        margin: 0;
        max-width: 260px;
        padding: 5px 10px 5px 10px;
        vertical-align: bottom;
      }

      .ddoc td {
        border: 1px solid rgba(233, 233, 233, 1);
        margin: 0;
        max-width: 260px;
        padding: 5px 10px 5px 10px;
        vertical-align: middle;
      }

      .punctuation {
        color: rgba(0, 0, 0, 1);
      }

      .comment {
        color: rgba(0, 131, 18, 1);
      }

      .operator {
        color: #000;
      }

      .keyword {
        color: rgba(170, 13, 145, 1);
      }

      .keyword_type {
        color: rgba(170, 51, 145, 1);
      }

      .string_literal {
        color: rgba(196, 26, 22, 1);
      }

      .ddoc_psuper_symbol {
        color: rgba(92, 38, 153, 1);
      }

      .param {
        color: rgba(0, 0, 0, 1);
      }

      .psymbol {
        color: rgba(0, 0, 0, 1);
      }

      .ddoc_member_header .ddoc_header_anchor .code {
        font-size: 1em;
      }
    </style>
  </head>
  <body id="ddoc_main" class="ddoc dlang">
    <div class="content_wrapper">
      <article class="module">
        <h1 class="module_name">requests.http</h1>
        <section id="module_content">
<section class="section ddoc_module_members_section">
  <div class="ddoc_module_members">
    <ul class="ddoc_members">
  <li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPResponse" id="HTTPResponse"><code class="code">HTTPResponse</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPResponse"></span>class <code class="code">HTTPResponse</code>: <span class="ddoc_psuper_symbol">requests.base.Response</span>;

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    Response - result of request execution.

  </p>
</div>
<div class="ddoc_description">
  <h4>Discussion</h4>
  <p class="para">
    Response.code - response HTTP code.
Response.status_line - received HTTP status line.
Response.responseHeaders - received headers.
Response.responseBody - container for received body
Response.history - for redirected responses contain all history
  </p>
</div>

</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest" id="HTTPRequest"><code class="code">HTTPRequest</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest"></span>struct <code class="code">HTTPRequest</code>;

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    Request.
Configurable parameters:
<b>method</b> - string, method to use (GET, POST, ...)
<b>headers</b> - string[string], add any additional headers you'd like to send.
<b>authenticator</b> - class Auth, class to send auth headers.
<b>keepAlive</b> - bool, set <code class="code">true</code> for keepAlive requests. default <code class="code">true</code>.
<b>maxRedirects</b> - uint, maximum number of redirects. default 10.
<b>maxHeadersLength</b> - size_t, maximum length of server response headers. default = 32KB.
<b>maxContentLength</b> - size_t, maximun content length. delault - 0 = unlimited.
<b>bufferSize</b> - size_t, send and receive buffer size. default = 16KB.
<b>verbosity</b> - uint, level of verbosity(0 - nothing, 1 - headers, 2 - headers and body progress). default = 0.
<b>proxy</b> - string, set proxy url if needed. default - <code class="code">null</code>.
<b>cookie</b> - Tuple Cookie, Read/Write cookie You can get cookie setted by server, or set cookies before doing request.
<b>timeout</b> - Duration, Set timeout value for connect/receive/send.

  </p>
</div>

</section>
<ul class="ddoc_members">
  <li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.addHeaders" id="HTTPRequest.addHeaders"><code class="code">addHeaders</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.addHeaders"></span>void <code class="code">addHeaders</code>(in string[string] <code class="code">headers</code>);

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    Add <code class="code">headers</code> to request

  </p>
</div>
<div class="ddoc_params">
  <h4>Parameters</h4>
  <table cellspacing="0" cellpadding="5" border="0" class="graybox">
    <tbody>
      <tr class="ddoc_param_row">
  <td scope="ddoc_param_id">
  <code class="code">
    <em class="term">string[string] <code class="code">headers</code></em>
  </code>
</td>
<td>
  <div class="ddoc_param_desc">
    <p class="para">
      <code class="code">headers</code> to send.
    </p>
  </div>
</td>
</tr>

    </tbody>
  </table>
</div>

</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.removeHeaders" id="HTTPRequest.removeHeaders"><code class="code">removeHeaders</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.removeHeaders"></span>pure void <code class="code">removeHeaders</code>(in string[] <code class="code">headers</code>);

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    Remove <code class="code">headers</code> from request

  </p>
</div>
<div class="ddoc_params">
  <h4>Parameters</h4>
  <table cellspacing="0" cellpadding="5" border="0" class="graybox">
    <tbody>
      <tr class="ddoc_param_row">
  <td scope="ddoc_param_id">
  <code class="code">
    <em class="term">string[] <code class="code">headers</code></em>
  </code>
</td>
<td>
  <div class="ddoc_param_desc">
    <p class="para">
      <code class="code">headers</code> to remove.
    </p>
  </div>
</td>
</tr>

    </tbody>
  </table>
</div>

</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.close_connection_if_not_keepalive" id="HTTPRequest.close_connection_if_not_keepalive"><code class="code">close_connection_if_not_keepalive</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.close_connection_if_not_keepalive"></span>void <code class="code">close_connection_if_not_keepalive</code>(NetworkStream <code class="code">_stream</code>);

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    If we do not want keepalive request,
or server signalled to close connection,
then close it

  </p>
</div>

</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.exec" id="HTTPRequest.exec"><code class="code">exec</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.exec"></span>HTTPResponse <code class="code">exec</code>(string method = "POST")(string <code class="code">url</code>, MultipartForm <code class="code">sources</code>);

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    Send multipart for request.
You would like to use this method for sending large portions of mixed data or uploading files to forms.
Content of the posted form consist of <code class="code">sources</code>. Each source have at least name and value (can be string-like object or opened file, see more docs for MultipartForm struct)

  </p>
</div>
<div class="ddoc_params">
  <h4>Parameters</h4>
  <table cellspacing="0" cellpadding="5" border="0" class="graybox">
    <tbody>
      <tr class="ddoc_param_row">
  <td scope="ddoc_param_id">
  <code class="code">
    <em class="term">string <code class="code">url</code></em>
  </code>
</td>
<td>
  <div class="ddoc_param_desc">
    <p class="para">
      <code class="code">url</code>
    </p>
  </div>
</td>
</tr>
<tr class="ddoc_param_row">
  <td scope="ddoc_param_id">
  <code class="code">
    <em class="term">MultipartForm <code class="code">sources</code></em>
  </code>
</td>
<td>
  <div class="ddoc_param_desc">
    <p class="para">
      array of <code class="code">sources</code>.
    </p>
  </div>
</td>
</tr>

    </tbody>
  </table>
</div>

</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.exec" id="HTTPRequest.exec"><code class="code">exec</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.exec.2"></span>HTTPResponse <code class="code">exec</code>(string method = "POST", R)(string <code class="code">url</code>, R <code class="code">content</code>, string <code class="code">contentType</code> = "application/octet-stream") if (rank!R == 1 || rank!R == 2 &amp;&amp; isSomeChar!(Unqual!(typeof(<code class="code">content</code>.front.front))) || rank!R == 2 &amp;&amp; is(Unqual!(typeof(<code class="code">content</code>.front.front)) == ubyte));

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    POST/PUT/... data from some string(with Content-Length), or from range of strings/bytes (use Transfer-Encoding: chunked).
When rank 1 (flat array) used as <code class="code">content</code> it must have length. In that case "<code class="code">content</code>" will be sent directly to network, and Content-Length headers will be added.
If you are goung to send some range and do not know length at the moment when you start to send request, then you can send chunks of chars or ubyte.
Try not to send too short chunks as this will put additional load on client and server. Chunks of length 2048 or 4096 are ok.

  </p>
</div>
<div class="ddoc_section">
  <p class="para">
    <span class="ddoc_section_h">Parameters:</span>
<code class="code">url</code> = <code class="code">url</code>
<code class="code">content</code> = string or input range
<code class="code">contentType</code> = <code class="code">content</code> type

  </p>
</div>
<div class="ddoc_returns">
  <h4>Return Value</h4>
  <p class="para">
    Response

  </p>
</div>
<div class="ddoc_examples">
  <h4>Examples</h4>
  <p class="para">
    
<section class="code_listing">
  <div class="code_sample">
    <div class="dlang">
      <ol class="code_lines">
        <li><code class="code">rs = rq.<span class="psymbol">exec</span>!<span class="string_literal">"POST"</span>(<span class="string_literal">"http://httpbin.org/post"</span>, <span class="string_literal">"привiт, свiт!"</span>, <span class="string_literal">"application/octet-stream"</span>);

<span class="keyword">auto</span> s = lineSplitter(<span class="string_literal">"one,\ntwo,\nthree."</span>);
rs = rq.<span class="psymbol">exec</span>!<span class="string_literal">"POST"</span>(<span class="string_literal">"http://httpbin.org/post"</span>, s, <span class="string_literal">"application/octet-stream"</span>);

<span class="keyword">auto</span> s = <span class="string_literal">"ABCDEFGHIJKLMNOPQRSTUVWXYZ"</span>;
rs = rq.<span class="psymbol">exec</span>!<span class="string_literal">"POST"</span>(<span class="string_literal">"http://httpbin.org/post"</span>, s.representation.chunks(10), <span class="string_literal">"application/octet-stream"</span>);

<span class="keyword">auto</span> f = File(<span class="string_literal">"tests/test.txt"</span>, <span class="string_literal">"rb"</span>);
rs = rq.<span class="psymbol">exec</span>!<span class="string_literal">"POST"</span>(<span class="string_literal">"http://httpbin.org/post"</span>, f.byChunk(3), <span class="string_literal">"application/octet-stream"</span>);
</code></li>
      </ol>
    </div>
  </div>
</section>

  </p>
</div>
</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.exec" id="HTTPRequest.exec"><code class="code">exec</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.exec.3"></span>HTTPResponse <code class="code">exec</code>(string method = "GET")(string <code class="code">url</code> = null, QueryParam[] <code class="code">params</code> = null);

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    Send request with parameters.
If used for POST or PUT requests then application/x-www-form-urlencoded used.
Request parameters will be encoded into request string or placed in request body for POST/PUT
requests.

  </p>
</div>
<div class="ddoc_section">
  <p class="para">
    <span class="ddoc_section_h">Parameters:</span>
<code class="code">url</code> = <code class="code">url</code>
<code class="code">params</code> = request parameters

  </p>
</div>
<div class="ddoc_returns">
  <h4>Return Value</h4>
  <p class="para">
    Response

  </p>
</div>
<div class="ddoc_examples">
  <h4>Examples</h4>
  <p class="para">
    
<section class="code_listing">
  <div class="code_sample">
    <div class="dlang">
      <ol class="code_lines">
        <li><code class="code">rs = Request().<span class="psymbol">exec</span>!<span class="string_literal">"GET"</span>(<span class="string_literal">"http://httpbin.org/get"</span>, [<span class="string_literal">"c"</span>:<span class="string_literal">"d"</span>, <span class="string_literal">"a"</span>:<span class="string_literal">"b"</span>]);
</code></li>
      </ol>
    </div>
  </div>
</section>

  </p>
</div>
</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.exec" id="HTTPRequest.exec"><code class="code">exec</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.exec.4"></span>HTTPResponse <code class="code">exec</code>(string method = "POST")(string <code class="code">url</code>, PostFile[] <code class="code">files</code>) if (method == "POST");

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    WRAPPERS

  </p>
</div>
<div class="ddoc_description">
  <h4>Discussion</h4>
  <p class="para">
    send file(s) using POST and multipart form.
This wrapper will be deprecated, use post with MultipartForm - it is more general and clear.

  </p>
</div>
<div class="ddoc_section">
  <p class="para">
    <span class="ddoc_section_h">Parameters:</span>
<code class="code">url</code> = <code class="code">url</code>
<code class="code">files</code> = array of PostFile structures

  </p>
</div>
<div class="ddoc_returns">
  <h4>Return Value</h4>
  <p class="para">
    Response
Each PostFile structure contain path to file, and optional field name and content type.
If no field name provided, then basename of the file will be used.
application/octet-stream is default when no content type provided.

  </p>
</div>
<div class="ddoc_section">
  <p class="para">
    <span class="ddoc_section_h">Example:</span>

<section class="code_listing">
  <div class="code_sample">
    <div class="dlang">
      <ol class="code_lines">
        <li><code class="code">PostFile[] <span class="param">files</span> = [
{fileName:<span class="string_literal">"tests/abc.txt"</span>, fieldName:<span class="string_literal">"abc"</span>, contentType:<span class="string_literal">"application/octet-stream"</span>},
{fileName:<span class="string_literal">"tests/test.txt"</span>}
];
rs = rq.<span class="psymbol">exec</span>!<span class="string_literal">"POST"</span>(<span class="string_literal">"http://httpbin.org/post"</span>, <span class="param">files</span>);
</code></li>
      </ol>
    </div>
  </div>
</section>

  </p>
</div>

</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.exec" id="HTTPRequest.exec"><code class="code">exec</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.exec.5"></span>HTTPResponse <code class="code">exec</code>(string method = "GET")(string <code class="code">url</code>, string[string] <code class="code">params</code>);

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    <code class="code">exec</code> request with parameters when you can use dictionary (when you have no duplicates in parameter names)
Consider switch to <code class="code">exec</code>(<code class="code">url</code>, QueryParams) as it more generic and clear.

  </p>
</div>
<div class="ddoc_section">
  <p class="para">
    <span class="ddoc_section_h">Parameters:</span>
<code class="code">url</code> = <code class="code">url</code>
<code class="code">params</code> = dictionary with field names as keys and field values as values.

  </p>
</div>
<div class="ddoc_returns">
  <h4>Return Value</h4>
  <p class="para">
    Response
  </p>
</div>

</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.get" id="HTTPRequest.get"><code class="code">get</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.get"></span>HTTPResponse <code class="code">get</code>(A...)(A <code class="code">args</code>);

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    GET request. Simple wrapper over exec!"GET"

  </p>
</div>
<div class="ddoc_params">
  <h4>Parameters</h4>
  <table cellspacing="0" cellpadding="5" border="0" class="graybox">
    <tbody>
      <tr class="ddoc_param_row">
  <td scope="ddoc_param_id">
  <code class="code">
    <em class="term">A <code class="code">args</code></em>
  </code>
</td>
<td>
  <div class="ddoc_param_desc">
    <p class="para">
      request parameters. see exec docs.
    </p>
  </div>
</td>
</tr>

    </tbody>
  </table>
</div>

</section>

</div>

</li><li class="ddoc_member">
  <div class="ddoc_member_header">
  <div class="ddoc_header_anchor">
  <a href="#HTTPRequest.post" id="HTTPRequest.post"><code class="code">post</code></a>
</div>
</div><div class="ddoc_decl">
  <section class="section">
    <div class="declaration">
      <h4>Declaration</h4>
      <div class="dlang">
        <p class="para">
          <code class="code">
            <span class="ddoc_anchor" id="HTTPRequest.post"></span>HTTPResponse <code class="code">post</code>(A...)(string <code class="code">uri</code>, A <code class="code">args</code>);

          </code>
        </p>
      </div>
    </div>
  </section>
</div>
<div class="ddoc_decl">
  <section class="section ddoc_sections">
  <div class="ddoc_summary">
  <p class="para">
    POST request. Simple wrapper over exec!"POST"

  </p>
</div>
<div class="ddoc_params">
  <h4>Parameters</h4>
  <table cellspacing="0" cellpadding="5" border="0" class="graybox">
    <tbody>
      <tr class="ddoc_param_row">
  <td scope="ddoc_param_id">
  <code class="code">
    <em class="term">string <code class="code">uri</code></em>
  </code>
</td>
<td>
  <div class="ddoc_param_desc">
    <p class="para">
      endpoint <code class="code">uri</code>
    </p>
  </div>
</td>
</tr>
<tr class="ddoc_param_row">
  <td scope="ddoc_param_id">
  <code class="code">
    <em class="term">A <code class="code">args</code></em>
  </code>
</td>
<td>
  <div class="ddoc_param_desc">
    <p class="para">
      request parameters. see exec docs.
    </p>
  </div>
</td>
</tr>

    </tbody>
  </table>
</div>

</section>

</div>

</li>
</ul>

</div>

</li>
</ul>
  </div>
</section>
</section>
      </article>
    </div>
  </body>
</html>
